package com.sl.config;

import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class Swagger2Config {

    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())//下边需要创建一个 apiInfo()
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.sl.controller"))
                .build()

                ;
    }


    private ApiInfo apiInfo() {
        //作者信息。
        Contact contact =new Contact("李琳达","辉煌国际大厦东6","霜林科技有限公司") ;
        return new ApiInfoBuilder()
                .title("系统管理的API文档") //设置文档的标题
                .description("市场监督管理局") // 设置文档的描述
                .version("3月初版本") // 设置文档的版本信息-> 1.0.0 Version information
                .contact(contact)
                .termsOfServiceUrl("霜林官方网址") // 设置文档的License信息->1.3 License information
                .build();
    }



}
